//
//  UIButton+DDUIButtonCategory.m
//  DDMusic
//
//  Created by rimi on 16/11/4.
//  Copyright © 2016年 FengBaoFamily. All rights reserved.
//

#import "UIButton+DDUIButtonCategory.h"

@implementation UIButton (DDUIButtonCategory)
+ (instancetype)dd_creatButtonTitle:(NSString*)title  buttonType:(UIButtonType)buttonType font:(CGFloat) font titieColor:(UIColor*)titleColor bgColor:(UIColor*)bgColor nomalImage:(NSString*)nomalImageStr bgImage:(NSString*)bgImage{
    UIButton* button;
    switch (buttonType) {
        case UIButtonTypeCustom:
            button = [UIButton buttonWithType:(UIButtonTypeCustom)];
            break;
        case UIButtonTypeRoundedRect:
            button =[UIButton buttonWithType:UIButtonTypeRoundedRect];
            break;
        default:
            break;
    }
    if (title != nil){
        [button setTitle:title forState:(UIControlStateNormal)];
    }
    if (titleColor!=nil) {
        [button setTitleColor:titleColor forState:(UIControlStateNormal)];
    }
    if (font != 0) {
        button.titleLabel.font = [UIFont systemFontOfSize:font];
    }
    if (bgColor!=nil) {
        button.backgroundColor = bgColor;
    }
    if (nomalImageStr!=nil) {
        [button setImage:[UIImage imageNamed:nomalImageStr] forState:(UIControlStateNormal)];
    }
    if (bgImage !=nil) {
        [button setBackgroundImage:[UIImage imageNamed:bgImage] forState:(UIControlStateNormal)];
    }
    return button;
    
}

@end
